package design_pattern;

public class AdapterPattern {
    public static void main(String[] args) {
        new Adapter(new Speaker()).translate();
    }
}
class Speaker{
    public String speak(){
        return "China";
    }
}
interface Translator{
    public String translate();
}
class Adapter implements Translator{
    private Speaker speaker;
    public Adapter(Speaker speaker){
        this.speaker = speaker;
    }
    @Override
    public String translate() {
        String speak = speaker.speak();
        //理解、手语话
        return speak;
    }
}